package com.example.dbmysql.mapper;

import com.example.dbmysql.pojo.Buildings;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface buildingsMapper {

    @Insert("insert into buildings(bon,bon_Name,floor,remark,create_timer,update_timer)"+
            "values(#{bon},#{bonName},#{floor},#{remark},now(),now())")
    void add(Buildings buildings);

    @Select("select * from buildings where id=#{id}")
    Buildings findBuildingsById(Integer id);

    @Select("select * from buildings where bon=#{bon}")
    Buildings findBuildingsByBon(String bon);

    @Update("update buildings set bon=#{bon},bon_Name=#{bonName},floor=#{floor},remark=#{remark},update_timer=#{updateTimer} where id=#{id} ")
    void update(Buildings buildings);


  @Select("select * from buildings  LIMIT #{page},#{pageSize}")
    List<Buildings> getAll(int page,int pageSize);

    @Delete("delete from buildings where id=#{id}")
    void delbuilingsByid(Integer id);
}
